package com.jinke.api.modules.app.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum PaymentType {
    OTHER(0, "其它"),
    CNY_PUBLIC(1, "人民币对公账户"),
    ALI_PUBLIC(2, "企业支付宝账户"),
    HK_PRIVATE(3, "香港个人银行账户信息"),
    ZELLE(4, "zelle 转账"),
    ACH(5, "ach和wire账户"),

    HK_PUBLIC(6, "香港对公银行账户"),
    CNY_PRIVATE(7, "人民币对私"),
    ;

    @EnumValue
    private final int value;
    private final String desc;

    PaymentType(final int value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    @JsonValue
    public int getValue() {
        return this.value;
    }

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static PaymentType defaultEnum(int value) {
        for (PaymentType type : PaymentType.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }
        throw new IllegalArgumentException("No element matches " + value);
    }
}